#pragma once
#include "shader.hpp"

class color_shader : public shader {
private:
	GLuint _matloc;
	GLuint _colorloc;
	
public:
	bool
	init(const char *vertexfile, const char *fragmentfile) {
		if (!linkprogram(vertexfile, fragmentfile))
			return false;
		_matloc = glGetUniformLocation(_program, "u_matrix");
		_colorloc = glGetUniformLocation(_program, "u_color");
		return true;
	}

	void
	setuniform(const glm::mat4 &matrix, GLfloat r, GLfloat g, GLfloat b) {
		glUniformMatrix4fv(_matloc, 1, GL_FALSE, glm::value_ptr(matrix));
		glUniform4f(_colorloc, r, g, b, 1.0f);
	}
	
	void 
	useprogram() {
		glUseProgram(_program);
	}
};